#include <func.h>
void *threadfunc(void *p)
{
    printf("I am subthread!\n");
    printf("Passed num = %ld\n",(long)p);
    pthread_exit((void*)2);
}
int main(int argc,char *argv[])
{
    int ret;
    pthread_t pthid;
    ret=pthread_create(&pthid,NULL,threadfunc,(void*)1);
    THREAD_ERROR_CHECK(ret,"pthread_create");
    printf("I am main thread\n");
    usleep(900);
    int retval=0;
    pthread_join(pthid,(void**)&retval);
    printf("Subthread's retval=%d\n",retval);
    return 0;
}

